package com.zxp01.selenium;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Z08_JavaScript {
    public static void main(String[] args) {
        /*使用js脚本打开一个新标签页*/
        WebDriver driver=new ChromeDriver();
        driver.manage().window().maximize();
        driver.get("https://www.baidu.com");

        // 强转为js
        JavascriptExecutor js=(JavascriptExecutor) driver;
        // 打开新窗口
        js.executeScript("window.open();");
    }
}
